﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Utils
{
   public class HashHelper
    {
        /// <summary>  
        /// 哈希加密一个字符串  
        /// </summary>  
        /// <param name="str"></param>  
        /// <returns></returns>  
        public static string Hash(string str)
        {
            byte[] Value;
            UnicodeEncoding Code = new UnicodeEncoding();
            byte[] Message = Code.GetBytes(str);
            SHA512Managed Arithmetic = new SHA512Managed();
            Value = Arithmetic.ComputeHash(Message);
            str = "";
            foreach (byte o in Value)
            {
                str += (int)o + "O";
            }
            return str.ToUpper();
        }
    }
}
